<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>

   function  randomArray(arr,num){//
       var brr = [] //
        for(var i=0; i <num; i++){
            var j = Math.floor(Math.random()*arr.length)
            if(brr.indexOf(arr[j])===-1){
                brr.push(arr[j])
            }else{
                i--
            }
        }
        return brr
   }
//   console.log( randomArray([2,2,2,4,5,6,8,9],5));
function equal(a1,a2){
    var a = true
    for(var i=0; i<a2.length; i++){
        if(a1.indexOf(a2[i]) !== -1){
            a=false
        }
    }
    return a
}
// console.log( equal([012,001,1,2,3,4],["a","b","c"]));

function largestOfFour(arr){
    let brr= []
   for(var i=0; i<arr.length;i++){
        arr[i].sort((a,b)=>{
            return b-a
        })
        brr.push(arr[i][0])
   }
   return brr
}
// console.log(largestOfFour([[5,7,9],[3,6,8],[1,3,10],[2,4,6,8,12]]));
 function uniqueNums(n){
     if(n>31)return "参数不能大于31,请重新输入"
     
     var brr = []
     for(var i=0; i<n; i++ ){
        var num = Math.floor(Math.random()*31+2) 
        if(brr.indexOf(num) === -1){
            brr.push(num)
        }else{
            i--
        }
     }
     return brr


 }
// console.log(uniqueNums(5));
 function unite(...arr){
     console.log(arr);
     let brr = []
  for(var i=0; i<arr.length; i++){
      for(var j=0; j<arr[i].length; j++){
          let str  =arr[i][j]
        if(brr.indexOf(str) === -1){
            brr.push(str)
        }
      }
  }
  return brr

 }
// console.log(unite([1,2,3],[2,4,6],[3,6,9]));

</script>